home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / pctchnqs / 1990 / number5 / flush.asm < prev    next >
Assembly Source File  |  1990-09-21  |  922b  |  31 lines

  1.  
  2. ;   int     flush(int handle);  
  3. ;  
  4. .model small  
  5. .code  
  6.     public  _flush  
  7.   
  8. _flush proc  
  9.     push    bp  
  10.     mov     bp,sp  
  11.     push    bx  
  12.   
  13.     mov     bx,[bp + 4]                 ; get file handle  
  14.     mov     ax,4500h                    ; DOS Dup Handle function 
  15.     int     21h                         ; call DOS - returns with
  16.  
  17.                                         ;   new handle in ax  
  18.     jc      flush_out                   ; jump if error  
  19.     mov     bx,ax                       ; move new handle to bx  
  20.     mov     ax,3e00h                    ; DOS Close function  
  21.     int     21h                         ; call DOS  
  22.     jc      flush_out                   ; jump if error  
  23.     mov     ax,0                        ; clear ax  
  24.     jmp     short flush_out             ; exit  
  25. flush_out:  
  26.     pop     bx  
  27.     pop     bp  
  28.     ret  
  29. _flush endp  
  30. end  
  31.